<template>
  <div class="video-pc" @click="toDetail(props.data.id)">
    <div class="video-img">
      <img
        :src="props.data?.firstImgUrl"
        alt=""
        style="width: 160px; height: 100px"
      />
      <div class="mask" v-if="props.data === null">
        <el-icon :size="20" style="margin-right: 5px"><Close /></el-icon>已下架
      </div>
    </div>
    <div class="video-main">
      <div class="main-title">{{ props.data?.title }}</div>
      <div class="muti-ell-2 fcolor">
        {{ props.data?.desc }}
      </div>
      <div style="margin-top: 10px; display: flex" class="fcolor">
        <div style="display: flex; align-items: center; margin-right: 30px">
          <img
            src="@/assets/icon/chakan2.png"
            alt=""
            style="width: 20px; height: 20px"
          />
          <div style="margin-left: 10px">
            {{ props.data?.lookCount || 0 }}
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-right: 30px">
          <img
            src="@/assets/icon/dianzan2.png"
            alt=""
            style="width: 20px; height: 20px"
          />
          <div style="margin-left: 10px">
            {{ props.data?.thumbUp || 0 }}
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-right: 30px">
          <img
            src="@/assets/icon/shoucang2.png"
            alt=""
            style="width: 20px; height: 20px"
          />
          <div style="margin-left: 10px">
            {{ props.data?.collection || 0 }}
          </div>
        </div>
      </div>
    </div>
    <div class="video-oper" @click="del(props.data.id)">
      <el-icon><Delete /></el-icon>
    </div>
  </div>
</template>

<script setup>
import { Delete, Close } from "@element-plus/icons-vue";
import { defineProps, defineEmits } from "vue";
import { useRouter } from "vue-router";
const props = defineProps({
  data: {
    type: Object,
    default: () => {},
  },
});
const emits = defineEmits(["del"]);

const del = (id) => {
  emits("del", id);
};
const router = useRouter();
const toDetail = (id) => {
  router.push({
    path: "/client/detail",
    query: {
      vid: id,
    },
  });
};
</script>

<style scoped lang="scss">
.video-pc {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  .video-img {
    width: 200px;
    position: relative;
  }

  .video-main {
    flex: 1;
    .main-title {
      font-weight: 600;
      font-size: 18px;
      margin-bottom: 10px;
    }
  }

  .video-oper {
    width: 130px;
    text-align: center;
  }
}

.mask {
  display: flex;
  width: 160px;
  height: 100px;
  position: absolute;
  background: rgba(0, 0, 0, 0.7);
  top: 0;
  left: 0;
  justify-content: center;
  align-items: center;
}
.mask:hover {
  cursor: pointer;
  color: #fff;
}
</style>
